<!-- 2017-12-4 14:24:10 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） -->
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,二维,地图,地球,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 二维 地图 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 二维地图 全景漫游 地理信息系统 云GIS 二维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="//mars2d.cn/favicon.ico" />
    <title>街景联动 | Mars2D | 地理信息平台 | 火星科技 | 合肥火星科技有限公司</title>

    <script
      type="text/javascript"
      src="../lib/include-lib.js"
      libpath="../lib/"
      include="jquery,font-awesome,bootstrap,layer,haoutil,mars2d"
    ></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=qObioeG8HeeQVrOVAGScPVhDzlmv6rL9"></script>

    <link href="css/style.css" rel="stylesheet" />

    <style>
      #centerDiv {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }

      .stree {
        width: 100%;
        height: 100%;
        overflow: hidden;
        margin: 0;
      }

      #centerDiv2D {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }

      .streetimg {
        position: absolute;
        right: 10px;
        top: 10px;
        height: 82px;
        width: 60px;
        background-color: rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(128, 128, 128, 0.5);
        box-shadow: 0 3px 14px rgba(128, 128, 128, 0.5);
        z-index: 999;
      }

      .icon {
        position: absolute;
        top: 10%;
        left: 34%;
      }

      .streetimg .text {
        display: block;
        margin-top: 48px;
        margin-left: 18px;
        color: azure;
      }

      .infoview {
        width: 240px;
      }
    </style>
  </head>

  <body class="dark">
    <div id="centerDiv">
      <iframe id="streeScape" class="stree" src="./h10_streetview_baidu.html?lng=117.215219&lat=31.861592"></iframe>
    </div>

    <div id="centerDiv2D">
      <div id="mars2dContainer" class="mars2d-container"></div>
    </div>

    <div id="viewQH" class="infoview" style="left: 43%; top: 2px">
      <input type="button" class="btn btn-primary" value="分屏" onclick=" splitScreen();" />
      <input type="button" class="btn btn-primary" value="仅街景" onclick="streetscape();" />
      <input type="button" class="btn btn-primary" value="仅2D" onclick="viewTo2d();" />
    </div>

    <script src="./js/common.js"></script>
    <script type="text/javascript">
      "use script"; //开发环境建议开启严格模式

      var map;
      var graphicLayer;

      function initMap(options) {
        //合并属性参数，可覆盖config.json中的对应配置
        var mapOptions = mars2d.Util.merge(options, {
          zoom: 17,
          center: { lng: 117.204281, lat: 31.857494 },
        });
        //创建地图
        map = new mars2d.Map("mars2dContainer", mapOptions);

        //矢量图层数据
        graphicLayer = new mars2d.layer.GraphicLayer();
        map.addLayer(graphicLayer);

        map.on(mars2d.EventType.click, function (event) {
          let point = event.latlng;
          updateMarker(point);

          let rightFrame = document.getElementById("streeScape");
          rightFrame.contentWindow.setPosition(point);
        });

        splitScreen();
      }

      let typeView = 0;

      //2d显示
      function viewTo2d() {
        typeView = 0;
        $("#centerDiv").hide();
        $("#centerDiv2D").css({ width: "100%" }).show();
        map.invalidateSize(false);
      }

      //街景显示
      function streetscape() {
        typeView = 1;
        $("#centerDiv2D").hide();
        $("#centerDiv").css({ width: "100%" }).show();
      }

      //分屏显示
      function splitScreen() {
        typeView = 2;
        $("#centerDiv").css({ width: "50%" }).show();
        $("#centerDiv2D").css({ width: "50%" }).show();
        map.invalidateSize(false);
      }

      let markerStreet;
      function updateMarker(latlng) {
        if (markerStreet) {
          markerStreet.latlng = latlng;
        } else {
          markerStreet = new mars2d.graphic.Marker({
            latlng: latlng,
            style: {
              image: "img/marker/street.png",
              scale: 1,
              horizontalOrigin: mars2d.HorizontalOrigin.CENTER,
              verticalOrigin: mars2d.VerticalOrigin.BOTTOM,
            },
          });
          graphicLayer.addGraphic(markerStreet);
        }

        if (!map.getBounds().contains(latlng)) {
          map.flyToPoint(latlng);
        }
      }
    </script>
  </body>
</html>
